#1.0
#curl -s https://gitee.com/api/v5/repos/acgboy/auto/raw/termux.sh?access_token=57f59c9af6493261c9bf3e5f692073b6 > /data/data/com.termux/files/usr/etc/termux-login.sh

line_count=$(wc -l < /data/data/com.termux/files/usr/etc/termux-login.sh)

if [ "$line_count" -eq 32 ]; then
    echo "$line_count"
    
    echo "#" >> /data/data/com.termux/files/usr/etc/termux-login.sh
    echo "#" >> /data/data/com.termux/files/usr/etc/termux-login.sh
    echo "#" >> /data/data/com.termux/files/usr/etc/termux-login.sh

    #sed -i 's@^\(deb.*stable main\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/termux-packages-24 stable main@' $PREFIX/etc/apt/sources.list
    #sed -i 's@^\(deb.*games stable\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/game-packages-24 games stable@' $PREFIX/etc/apt/sources.list.d/game.list
    #sed -i 's@^\(deb.*science stable\)$@#\1\ndeb https://mirrors.tuna.tsinghua.edu.cn/termux/science-packages-24 science stable@' $PREFIX/etc/apt/sources.list.d/science.list
    
    #pkg update
    termux-setup-storage
    pkg install openssh jq -y
    sshd;pkill sshd
    curl -s https://gitee.com/api/v5/repos/acgboy/auto/raw/id_ed25519.pub?access_token=57f59c9af6493261c9bf3e5f692073b6 > /data/data/com.termux/files/home/.ssh/authorized_keys
    sed -i 's/^#\s*\(PasswordAuthentication\s*\)yes/\1no/' $PREFIX/etc/ssh/sshd_config
fi


if pgrep sshd > /dev/null
then
  echo 'sshd is stared!'
else
  sshd
  echo 'start sshd!'
fi
